package com.yx.filesystem.storage;

import java.util.ArrayList;
import java.util.List;

public class Node {
	String id;
	String host;
	int port;
	List<Node> bachupNodes = new ArrayList<Node>();

	public Node(String id,String host, int port)throws Exception {
		if(id==null||id.trim().length()!=5)throw new Exception("节点ID必须是不带空格的5位长字符串");
		this.id=id;
		this.host = host;
		this.port = port;
	}
	
	public String getId() {
		return id;
	}

	public String getHost() {
		return host;
	}

	public int getPort() {
		return port;
	}

	public List<Node> getBachupNodes() {
		return bachupNodes;
	}

	public void addBachupNodes(Node node) {
		this.bachupNodes.add(node);
	}
	

}
